package cn.tedu._07springaop.aop;

import org.springframework.stereotype.Component;

@Component
public class CalculatorImpl implements Calculator{
    @Override
    public int add(int a, int b) {
//        if(a>0){
//            throw new RuntimeException("参数a不能为正数");
//        }
        int result = a + b;
        System.out.println("result:"+ result);
        return result;
    }

    @Override
    public int sub(int a, int b) {
        int result = a - b;
        System.out.println("执行了减法运算");
        return result;
    }

    @Override
    public int mul(int a, int b) {
        int result = a * b;
        System.out.println("执行了乘法运算");
        return result;
    }
    @Override
    public int div(int a, int b) {
        int result = a / b;
        System.out.println("执行了除法运算");
        return result;
    }




}
